<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Quick Start - Layui</title>
    <link href="//cdn.staticfile.net/layui/2.9.13/css/layui.css" rel="stylesheet">
</head>
<body>
<!-- HTML Content start_1-->
<fieldset class="layui-elem-field">

    <legend>基础设置</legend>
    <div class="layui-field-box layui-form layui-form-pane">

        <div class="layui-form-item">
            <label class="layui-form-label">选择分区</label>
            <div class="layui-input-inline">
                <select id="serverid" name="serverid" lay-filter="serverid" lay-search>
                    <option value=''>请选择区服</option>
                    {volist name="serverList" id="serverItem"}
                    <option value="{$serverItem.sid}">{$serverItem.name}</option>
                    {/volist}
                </select>
            </div>

            <label class="layui-form-label layui-inline" style="margin-left: 20px;">区服多选</label>
            <div class="layui-input-inline" style="width: auto;">
                <input type="checkbox" name="MultizoneSwitch" lay-skin="switch" lay-filter="MultizoneSwitch"
                       title="开|关">
            </div>
        </div>
        <!--多区时区服列表-->
        <div id="serverListShow" class="layui-input-block" style="display: none;">
            {volist name="serverList" id="server"}
            <input type="checkbox" id="server_{$serverItem.sid}" name="server" lay-skin="tag" title="{$server.name}"
                   value="{$server.sid}">
            {/volist}
        </div>


        <div class="layui-form-item">
            <div id="gameAccount">  <!--- <-表单控制id-->
                <label class="layui-form-label">游戏账号</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" lay-affix="playerId" id="playerId" name="playerId"
                           lay-filter="playerId">
                </div>
                <label class="layui-form-label">游戏角色</label>
                <div class="layui-input-inline">
                    <select id="playName" name="playName" lay-filter="playName" lay-search>
                        <option value=''>无选项</option>
                    </select>
                </div>
            </div>
        </div>

    </div>
</fieldset>
<!-- HTML Content end_1-->

<!-- HTML Content start_2-->
<div class="layui-card">
    <div class="layui-card-body">
        <div class="layui-tab layui-tab-brief" lay-filter="component-tabs-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">-----平台币发放-----</li>
                <li>-----邮件发送-----</li>
                <li>-----日常福利-----</li>
                <li>-----角色管理-----</li>
                <li>-----权限管理-----</li>
                <li>-----累充返利-----</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-field-box layui-form layui-form-pane">
                        <div class="layui-form-item">
                            <label class="layui-form-label">充值类型</label>
                            <div class="layui-input-block">
                                <select id="chargeType" name="chargeType" class="form-control selectpicker"
                                        data-size="5" title="请选择类型" required>
                                    <option value="000000000">平台币</option>
                                    <option value="111111111">钻石</option>
                                    <option value="222222222">盲盒金币</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">数量</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" id="chargenum" value="">
                            </div>
                        </div>
                        <div class="layui-btn-container">
                            <button type="button" class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                                    id="chargebtn"
                                    value="充值">充值
                            </button>
                            <br>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-field-box layui-form layui-form-pane">
                        <div class="layui-form-item">

                            <label for="mailHead" class="layui-form-label">邮箱标题</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" id="mailHead" value=""><br>
                            </div>

                            <label for="mailContext" class="layui-form-label">邮箱内容</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" id="mailContext" value=""><br>
                            </div>

                            <label class="layui-form-label">物品选择</label>
                            <div class="layui-input-block">
                                <select id="mailid" lay-verify="" lay-search>
                                    {volist name="items" id="item"}
                                    <option value="{$item.value}">{$item.name}</option>
                                    {/volist}
                                </select>
                                <br>
                            </div>

                            <label for="mailnum" class="layui-form-label">物品数量</label>
                            <div class="layui-input-block">
                                <input type="text" class="layui-input" id="mailnum" value=""><br>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">装备多选</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" name="moreEquip" lay-filter="moreEquip" lay-skin="switch"
                                           lay-text="开启|关闭">
                                </div>
                            </div>

                            <div class="layui-input-block" id='itemList' style="display: none;">
                                <!--多选物品列表-->
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-btn-container">
                                <!--	 邮箱发送，并不是马上同步到数据库表mails中，大约5~10分钟内同步  	-->
                                <button type="button" class="layui-btn layui-btn-normal layui-btn-fluid layui-btn-lg"
                                        id="mailAdd" value="添加">添加
                                </button>
                                <button type="button" class="layui-btn layui-btn-fluid layui-btn-lg" id="mailbtn"
                                        value="发送邮件">发送物品
                                </button>
                            </div>
                            <br>
                            <div class="layui-btn-container">
                                <input type="button" id='allmailbtn'
                                       class="layui-btn layui-btn-fluid layui-btn-danger layui-btn-lg"
                                       value='发送全服邮件'>
                                <br>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-tab-item">
                    <div class="layui-btn-container">
                        <input type="button" id='fst' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='粉丝团'>
                        <input type="button" id='mrfd' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='福袋'>
                        <input type="button" id='svip1' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='SVIP1群'>
                        <input type="button" id='svip2' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='SVIP2群'>
                        <input type="button" id='svip3' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='SVIP3群'>
                        <input type="button" id='sviplb' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='SVP老板群'>
                        <input type="button" id='nsviplb'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发SVP老板群'>
                        <input type="button" id='gmjl' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='冠名奖励'>
                        <input type="button" id='ngmjl' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发冠名奖励'>
                    </div>
                </div>

                <div class="layui-tab-item">
                    <div class="layui-field-box">
                        <div class="layui-form layui-row layui-col-space16">
                            <select class="form-control selectpicker" id="chargenum2" name="num">
                                <option value='55' desc=''>角色封号</option>
                                <option value='66' desc=''>角色解封</option>
                                <option value='11' desc=''>角色禁言(角色名字)(预留)</option>
                                <option value='22' desc=''>取消禁言(角色名字)(预留)</option>
                            </select>
                        </div>
                        <button type='button' class="layui-btn layui-btn-danger layui-btn-fluid" id='chargebtn2'>
                            修改属性
                        </button>
                    </div>
                </div>

                <div class="layui-tab-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md3">
                            <button type="button" id="addvipbtn"
                                    class="layui-btn layui-btn-fluid layui-btn-danger layui-btn-lg">加入权根
                            </button>
                        </div>
                        <div class="layui-col-md3">
                            <button type="button" id="unsetvipbtn"
                                    class="layui-btn layui-btn-fluid layui-bg-cyan layui-btn-lg">取消授权
                            </button>
                        </div>
                        <!-- <div class="layui-col-md3">-->
                        <!--      <button type="button" value="禁言" id="jybtn" class="layui-btn layui-btn-fluid layui-btn-danger layui-btn-lg">角色禁言(角色名字)</button>-->
                        <!--  </div> -->
                        <!-- <div class="layui-col-md3">  -->
                        <!--  <button type="button" value="解禁" id="jfbtn" class="layui-btn layui-btn-fluid layui-bg-cyan layui-btn-lg">取消禁言(角色名字)</button>-->
                        <!--  </div>   -->
                    </div>
                </div>

                <div class="layui-tab-item">
                    <div class="layui-btn-container">
                        <input type="button" id='lc100' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充100元'>
                        <input type="button" id='lc300' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充300元'>
                        <input type="button" id='lc500' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充500元'>
                        <input type="button" id='lc1000' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充1000元'>
                        <input type="button" id='lc1500' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充1500元'>
                        <input type="button" id='lc2000' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充2000元'>
                        <input type="button" id='lc2500' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充2500元'>
                        <input type="button" id='lc3000' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充3000元'>
                        <input type="button" id='lc3500' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充3500元'>
                        <input type="button" id='lc4000' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充4000元'>
                        <input type="button" id='lc4500' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充4500元'>
                        <input type="button" id='lc5000' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充5000元'>
                        <input type="button" id='lc6000' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充6000元'>
                        <input type="button" id='nlc6000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充6000元'>
                        <input type="button" id='lc7000' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充7000元'>
                        <input type="button" id='nlc7000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充7000元'>
                        <input type="button" id='lc8000' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充8000元'>
                        <input type="button" id='nlc8000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充8000元'>
                        <input type="button" id='lc9000' class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充9000元'>
                        <input type="button" id='nlc9000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充9000元'>
                        <input type="button" id='lc10000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充10000元'>
                        <input type="button" id='nlc10000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充10000元'>
                        <input type="button" id='lc15000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充15000元'>
                        <input type="button" id='nlc15000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充15000元'>
                        <input type="button" id='lc20000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充20000元'>
                        <input type="button" id='nlc20000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充20000元'>
                        <input type="button" id='lc25000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充25000元'>
                        <input type="button" id='nlc25000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充25000元'>
                        <input type="button" id='lc30000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充30000元'>
                        <input type="button" id='nlc30000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充30000元'>
                        <input type="button" id='lc35000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充35000元'>
                        <input type="button" id='nlc35000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充35000元'>
                        <input type="button" id='lc40000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充40000元'>
                        <input type="button" id='nlc40000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充40000元'>
                        <input type="button" id='lc45000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充45000元'>
                        <input type="button" id='nlc45000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充45000元'>
                        <input type="button" id='lc50000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充50000元'>
                        <input type="button" id='nlc50000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充50000元'>
                        <input type="button" id='lc55000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充55000元'>
                        <input type="button" id='nlc55000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充55000元'>
                        <input type="button" id='lc60000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充60000元'>
                        <input type="button" id='nlc60000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充60000元'>
                        <input type="button" id='lc65000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充65000元'>
                        <input type="button" id='nlc65000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充65000元'>
                        <input type="button" id='lc70000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充70000元'>
                        <input type="button" id='nlc70000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充70000元'>
                        <input type="button" id='lc75000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充75000元'>
                        <input type="button" id='nlc75000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充75000元'>
                        <input type="button" id='lc80000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充80000元'>
                        <input type="button" id='nlc80000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充80000元'>
                        <input type="button" id='lc85000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充85000元'>
                        <input type="button" id='nlc85000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充85000元'>
                        <input type="button" id='lc90000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充90000元'>
                        <input type="button" id='nlc90000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充90000元'>
                        <input type="button" id='lc95000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充95000元'>
                        <input type="button" id='nlc95000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充95000元'>
                        <input type="button" id='lc100000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充100000元'>
                        <input type="button" id='nlc100000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充100000元'>
                        <input type="button" id='lc105000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充105000元'>
                        <input type="button" id='nlc105000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充105000元'>
                        <input type="button" id='lc110000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充110000元'>
                        <input type="button" id='nlc110000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充110000元'>
                        <input type="button" id='lc115000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充115000元'>
                        <input type="button" id='nlc115000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充115000元'>
                        <input type="button" id='lc120000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充12000元'>
                        <input type="button" id='nlc120000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充12000元'>
                        <input type="button" id='lc125000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充125000元'>
                        <input type="button" id='nlc125000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充125000元'>
                        <input type="button" id='lc130000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充130000元'>
                        <input type="button" id='nlc130000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充130000元'>
                        <input type="button" id='lc135000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充135000元'>
                        <input type="button" id='nlc135000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充135000元'>
                        <input type="button" id='lc140000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充140000元'>
                        <input type="button" id='nlc140000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充140000元'>
                        <input type="button" id='lc145000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充145000元'>
                        <input type="button" id='nlc145000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充145000元'>
                        <input type="button" id='lc150000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='累充150000元'>
                        <input type="button" id='nlc150000'
                               class="layui-btn layui-btn-fluid layui-btn-normal layui-btn-lg"
                               value='补发累充150000元'>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- HTML Content End_2-->

<!-- 引入 layui 模块 -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="//cdn.staticfile.net/layui/2.9.13/layui.js"></script>
<script>
    $('#mailAdd').hide(); // 隐藏 mailAdd 按钮
    //获取后端传过来的adminId
    $adminId = "{$adminId}";
    layui.use(['table', 'form', 'jquery', 'laydate'], function () {
        var form = layui.form;
        var layer = layui.layer;
        let MODULE_PATH = "{$Request.root}/admin.GmEmail/";

        //存储变量定义
        var serverIdList = [];//区服列表
        var itemListBox = [];//物品列表
        var playerId = '';//玩家ID
        var playerRoleId = "";//玩家角色ID
        var playerRoleName = '';//玩家角色名称

        // 初始化-----页面加载完成时执行一次
        $(document).ready(function () {
            // 初始禁用区服下拉框
            $('#serverid').prop('disabled', true);
            form.render('select'); // 重新渲染下拉框
        });

        // 指定区服开关事件
        form.on('switch(MultizoneSwitch)', function (data) {
            if (this.checked) {
                console.log("区服多选")
                manyServer();// 指定区服多选事件
            } else {
                oneServer();// 指定区服单选事件
            }
        });

        // 指定物品多选开关事件
        form.on('switch(moreEquip)', function (data) {
            if (this.checked) {
                console.log("物品多选")
                $('#mailAdd').show(); // 显示 添加 按钮
                $('#itemList').show() // 显示 物品列表 区域
            } else {
                $('#mailAdd').hide(); // 隐藏 添加 按钮
                $('#itemList').hide() // 隐藏 物品列表 区域
            }
        });

        // 指定区服多选事件
        function manyServer() {
            $('#serverListShow').show(); //显示区服列表
            $('#serverid, #playerId, #playName').val('').prop('disabled', true); // 清空并禁用
            form.render('select'); // 重新渲染下拉框
            refreshServerList(); //获取区服
            // 监听区服选择---serverIdList
            form.on('checkbox(server)', function (data) {
                var serverId = data.value;
                if (data.elem.checked) {
                    if (serverIdList.indexOf(serverId) === -1) {
                        serverIdList.push(serverId); // 将勾选的区服添加到serverIdList中
                    }
                } else {
                    var index = serverIdList.indexOf(serverId);
                    if (index !== -1) {
                        serverIdList.splice(index, 1); // 取消勾选时从serverIdList中移除
                    }
                }
                console.log('serverIdList:', serverIdList);
            });
        }

        // 指定区服单选事件
        function oneServer() {
            console.log('serverIdList:', serverIdList); //调试
            $('#serverListShow').hide(); //隐藏区服列表
            $('#serverListShow input[type="checkbox"]').prop('checked', false); // 清空页面已勾选的区服列表
            serverIdList = []; // 清空待发送的区服列表
            $('#serverid, #playerId, #playName').val('').prop('disabled', false); // 清空并启用
            form.render('select'); // 重新渲染下拉框
        }

        // 玩家账号实时输入事件
        $('#playerId').on('input', function ($playName) {
            var $playName = $('#playName');
            $playName.empty(); // 清空角色框
            getActor(); //查询角色
        });

        //获取玩家游戏角色
        function getActor() {
            var accountId = $('#playerId').val(); // 获取玩家账号
            var serverId = $('#serverid').val(); // 获取选择的区服ID
            var adminId = $adminId; // 获取当前操作管理员ID

            $('#playName').val(''); // 清空并禁用
            form.render('select'); // 重新渲染下拉框

            if (accountId && serverId && adminId) {
                $.ajax({
                    url: MODULE_PATH + 'getPlayerById',  // 替换为你的后端接口路径
                    type: 'POST',
                    data: {
                        adminId: adminId,
                        accountId: accountId,
                        serverId: serverId
                    },
                    success: function (response) {
                        console.log(response);
                        var roleList = response.roleList;  // 返回的数据中的 roleList
                        var $playName = $('#playName'); // 获取角色下拉框
                        if (roleList != null && roleList.length > 0) {
                            roleList.forEach(function (role, index) {
                                var selected = index === 0 ? 'selected' : '';
                                $playName.append(`<option value="${role.actorid}" ${selected}>${role.actorname}</option>`);
                            });
                            form.render('select');  // 重新渲染下拉框
                        } else {
                            return -1;
                        }
                    },
                    error: function (xhr, status, error) {
                        var errorMessage = xhr.responseJSON ? xhr.responseJSON.msg : '查询失败，请稍后重试';
                        layer.msg(errorMessage);
                    }
                });
            }
        }  //getActor--end

        //切换分区时清空游戏账号输入框
        form.on('select(serverid)', function (data) {
            $('#playerId, #playName').val(''); // 清空游戏账号输入框、角色下拉框
            form.render('select'); // 重新渲染下拉框
        });

        // 点击充值事件
        $('#chargebtn').on('click', function () {
            var playerId = $('#playerId').val();// 获取玩家ID
            var serverId = $('#serverid').val();// 获取选择的区服ID
            var playName = $('#playName').val();// 获取玩家昵称
            var chargenum = $('#chargenum').val();// 获取充值数量
            var chargeType = $('#chargeType').val();// 获取充值类型
            // 获取当前登录的管理员ID
            var adminId = $adminId;
            if (adminId == null) {
                layer.msg('登录数据已失效，请先登录!');
                return;
            }
            if (playerId && serverId && playName && chargenum && chargeType) {
                // 执行充值操作
                $.ajax({
                    url: MODULE_PATH + 'recharge',  // 替换为你的后端接口路径
                    type: 'POST',
                    data: {
                        type: 'charge',
                        adminId: adminId,
                        playerId: playerId,
                        serverId: serverId,
                        playName: playName,
                        chargeNum: chargenum,
                        chargeType: chargeType
                    },
                    'cache': false,  // 防止缓存
                    'dataType': 'json',  // 预期服务器返回 JSON 格式数据
                    success: function (response) {
                        if (response.code === 200) {
                            layer.msg('充值成功');
                        } else {
                            layer.msg('充值失败');
                        }
                    },
                    error: function () {
                        layer.msg('充值失败，请稍后重试');
                    }
                });
            } else {
                layer.msg('请输入完整信息');
            }
        });

        // 监听区服下拉框点击事件---刷新区服列表
        //todo  监听失效，后期需修改
        $('#serverid').on('mouseover', function () {
            console.log("监听区服下拉框点击事件");
            refreshServerList();
        });

        //刷新区服列表
        function refreshServerList() {
            console.log("区服刷新")
            $.ajax({
                url: MODULE_PATH + 'getServerList',  // 替换为你的后端接口路径
                type: 'GET',
                success: function (response) {
                    var serverList = response.serverList;  // 返回的数据中的 serverList
                    var $serverSelect = $('#serverid');
                    var $serverListShow = $('#serverListShow');
                    //更新区服选择下拉框
                    $serverSelect.empty();  // 清空下拉框
                    $serverSelect.append('<option value="">请选择区服</option>');// 添加默认选项
                    serverList.forEach(function (server) {
                        // 填充新的区服列表数据
                        $serverSelect.append('<option value="' + server.sid + '">' + server.name + '</option>');
                    });
                    form.render('select');  // 重新渲染下拉框

                    //更新多区展示列表
                    $serverListShow.empty();// 清空多区时区服列表展示
                    // 填充新的区服列表数据到多区时区服列表展示
                    serverList.forEach(function (server) {
                        $serverListShow.append('<input type="checkbox" id="server_' + server.sid + '" name="server" lay-skin="tag" title="' + server.name + '" value="' + server.sid + '">');
                    });
                    form.render('checkbox');  // 重新渲染多区时区服列表展示的复选框
                },
                error: function (xhr, status, error) {
                    var errorMessage = xhr.responseJSON ? xhr.responseJSON.msg : '查询失败，请稍后重试';
                    layer.msg(errorMessage);
                }
            });
        }


    });/*use_End*/

</script>
</body>
</html>